<?php use_helper('jQuery'); ?>
<?php include_javascripts(); ?>
<?php if($sf_user->isAuthenticated())  $uid = $sf_user->getGuardUser()->getId() ?>
<script>
var RecaptchaOptions = {
   theme : "clean",
   custom_theme_widget: "recaptcha_widget"
};
</script>

<hr	style='height: 1px; color: #EEE'>

<div id="bigcommentblock">
<?php if (count($comments)>0)
	{ foreach ($comments as $comment) {	?>
<div class="bodycomment" id="bodycomment<?php echo $comment['id']; ?>">
<div class='h2'><?php echo $comment['user_id'] ? $comment['SfGuardUser']['firstname'].' '.$comment['SfGuardUser']['lastname'] : $comment['guest_name'] ?>
</div>
<div class="cbody"><?php echo $comment['body']; ?></div>
<em class="date"><?php echo format_date(strtotime($comment['created_at']),'f','ru');?></em>
			<?php if(isset($uid)) { if ( $comment['user_id'] == $uid) { ?> 
<em	id="delete" class="date"><?php echo jq_link_to_remote("удалить", array('url' 		=> 'comment/delete?comid='.$comment['id'],
																		   'complete' 	=> '$("#bodycomment'.$comment['id'].'").hide();' ), array()) ;?></em>
	<?php }} ;
	?>
</div>
	<?php }; ?>

	<?php } else { ?>
<div id='noquestions'><i>На данный момент отзывов еще нет</i> <br />
<br />
</div>

	<?php } ?>
</div>
	<?php  if ($sf_user->isAuthenticated()){?>
	
<form method='post' action='<?php echo url_for('comment/submit') ?>'>
<table>
<?php echo $form; ?>
<tr>
<th>Антиспам:</th>
<td>
<img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" />
<br />
<input type="text" style='margin-top:5px;' name="captcha_code" size="10" maxlength="6" />
<a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false">Обновить изображение</a>
</td></tr>
</table>

<input type='hidden' name='<?php echo 'entity_id2' ?>'
	value='<?php echo $entity_id ?>' /> <input type='hidden'
	name='<?php echo 'entity_type2' ?>' value='<?php echo $entity_type ?>' />
<br />
<input type='submit' style='margin-left:124px;' class='commentbutton' value='Оставить отзыв' />
</form>

<?php
	}
	else // Если юзер не выполнил вход
	{
		?>

<form method='post' action='<?php echo url_for('comment/submitnext') ?>'>
<table>
<?php
echo $unregform; ?>
<tr>
<th>Антиспам:</th>
<td>
<img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" />
<br />
<input type="text" style='margin-top:5px;' name="captcha_code" size="10" maxlength="6" />
<a href="#" onclick="document.getElementById('captcha').src = 
					'/securimage/securimage_show.php?' + Math.random(); return false">Обновить изображение</a>
</td></tr>
</table>

<input type='hidden' name='<?php echo 'entity_id2' ?>'
	value='<?php echo $entity_id ?>' /> <input type='hidden'
	name='<?php echo 'entity_type2' ?>' value='<?php echo $entity_type ?>' />
<br />
<input type='submit' style='margin-left:124px;' class='commentbutton' value='Оставить отзыв' /></form>

<?php } ?>
<script type='text/javascript'>
function editrecaptcha()
{ 
//	$("#recaptcha_reload_btn").hide();
//	$("#recaptcha_switch_audio_btn").hide();
//	$("#recaptcha_switch_img_btn").hide();
//	$("#recaptcha_whatsthis_btn").hide();
//	$("#recaptcha_logo").hide();
//	$("#recaptcha_tagline").hide();
}
editrecaptcha();
</script>